package com.reebake.ideal.storage.controller;

import com.reebake.ideal.storage.entity.FileInfoDTO;
import com.reebake.ideal.storage.entity.PresignedUrlParam;
import com.reebake.ideal.storage.entity.PresignedUrlResult;
import com.reebake.ideal.storage.service.FilePresignedService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/storage/file")
public class FilePresignedController {
    @Autowired
    private FilePresignedService filePresignedService;

    @PostMapping("presigned")
    public PresignedUrlResult presigned(@RequestBody PresignedUrlParam presignedUrlParam) {
        return filePresignedService.presigned(presignedUrlParam);
    }

    @PostMapping("presigned/record")
    public FileInfoDTO record(@RequestBody PresignedUrlParam presignedUrlParam) {
        return filePresignedService.record(presignedUrlParam);
    }
    
}
